
package fileby.ctrl.actions.impl;

import fileby.core.ActionKey;
import fileby.model.IFavoriteManager;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

/**
 *
 * @author Jacob
 */
class RemoveFromFavoritesAction extends AbstractAction {

    private IFavoriteManager favoriteManager;

    public RemoveFromFavoritesAction(IFavoriteManager favoriteManager) {
        super("Remove from Favorites", null);
        this.favoriteManager = favoriteManager;
        putValue(SHORT_DESCRIPTION, "Removes selected file from Favorites");
    }

    public void actionPerformed(ActionEvent e) {
        String path = (String)this.getValue(ActionKey.REMOVE_FROM_FAVORITES.toString());
        favoriteManager.removeFavorite(path);
    }

}
